package com.example.mybatis1.mapper;

import com.example.mybatis1.bean.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserMapper1 {
    @Select("select * from user;")
    List<User> getAllUser();

    @Select("select * from user where id = #{id};")
    User getUserById(Integer id);

    @Insert("insert into user(username, address) values (#{username}, #{address});")
    void addUser(User user);

    @Update("update user set username = #{username} where user.id = #{id};")
    void updateUser(User user);

    @Delete("delete from user where user.id = #{id};")
    void deleteUser(Integer id);
}
